import request from '../utils/request'
import { CODE_API, SESSION_API } from '@/constants/api'
/**
 * 根据手机号获取验证码
 * @param phone
 * @returns
 */
export const getCode = (phone) =>
  request({
    url: CODE_API.replace('{phone}', phone),
  })

/**
 * 根据手机号与验证码登录
 * @param user {phone, code}
 * @returns
 */
export const login = (user) =>
  request({
    url: SESSION_API,
    method: 'POST',
    data: user,
  })
